/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.pneuservis.soap.dto;

import pneuservis.backend.to.CustomerTO;
import pneuservis.backend.to.ServicePneuTO;
import pneuservis.backend.to.TyreTypeTO;

/**
 *
 * @author Admin
 */
public class Transfer {
    
    public static CustomerTO toCustomerTO(CustomerDTO customer){
        if(customer == null) {
            return null;
        }
        
        CustomerTO result = new CustomerTO();
        result.setId(customer.getId());
        result.setAddress(customer.getAddress());
        result.setName(customer.getName());
        result.setPhone(customer.getPhone());
        return result;
    }
    
    public static CustomerDTO toCustomerDTO(CustomerTO customer){
        if(customer == null) {
            return null;
        }
        
        CustomerDTO result = new CustomerDTO();
        result.setId(customer.getId());
        result.setAddress(customer.getAddress());
        result.setName(customer.getName());
        result.setPhone(customer.getPhone());
        return result;
    }
    
    public static ServicePneuTO toServicePneuTO(ServiceDTO service){
        if(service == null) {
            return null;
        }
        
        ServicePneuTO result = new ServicePneuTO();
        result.setId(service.getId());
        result.setPrice(service.getPrice());
        result.setName(service.getName());
        return result;
    }
    
    public static ServiceDTO toServiceDTO(ServicePneuTO service){
        if(service == null) {
            return null;
        }
        
        ServiceDTO result = new ServiceDTO();
        result.setId(service.getId());
        result.setPrice(service.getPrice());
        result.setName(service.getName());
        return result;
    }
    
    public static TyreTypeDTO toTyreTypeDTO(TyreTypeTO tyre){
        if(tyre == null) {
            return null;
        }
        
        TyreTypeDTO result = new TyreTypeDTO();
        result.setId(tyre.getId());
        result.setPrice(tyre.getPrice());
        result.setManufacturer(tyre.getManufacturer());
        result.setProfile(tyre.getProfile());
        result.setRimSize(tyre.getRimSize());
        result.setWidth(tyre.getWidth());
        result.setSeason(tyre.getSeason());
        
        return result;
    }
    
    public static TyreTypeTO toTyreTypeTO(TyreTypeDTO tyre){
        if(tyre == null) {
            return null;
        }
        
        TyreTypeTO result = new TyreTypeTO();
        result.setId(tyre.getId());
        result.setPrice(tyre.getPrice());
        result.setManufacturer(tyre.getManufacturer());
        result.setProfile(tyre.getProfile());
        result.setRimSize(tyre.getRimSize());
        result.setWidth(tyre.getWidth());
        result.setSeason(tyre.getSeason());
        
        return result;
    }
}
